from langchain.chat_models import ChatOpenAI
from langchain.schema import HumanMessage, SystemMessage

"""
https://blog.csdn.net/weixin_62533513/article/details/146189994
"""


def test():
    #
    llm = ChatOpenAI(
        api_key="sk-VowKQBUMIkSND8WScNJtDLqf3FyqWHQ43LMVUXH1m6GZaopA",
        base_url="https://ai.nengyongai.cn/v1"
    )
    #
    messages = [
        SystemMessage(content="将英语翻译成中文"),
        HumanMessage(content="I love programming.")
    ]

    #
    response = llm.invoke(messages)
    print(response.content)
